package com.youtills.resource;

/**
 * TODO - !!!doc me!!!
 *
 * @author ravi.chiluveru
 * @since 23.0 (8/14/14)
 */
public interface RelationshipBak<L extends Resource, R extends Resource>{

    String getRelationshipName();
    Long getRelationshipId();
    Class<L> getLeftClass();
    Class<R> getRightClass();
    Integer getLeftMinCount();
    Integer getLeftMaxCount();
    Integer getRightMinCount();
    Integer getRightMaxCount();

    Boolean getAllowDuplicate();

    class Builder<L extends Resource, R extends Resource> {
        private String relationshipName;
        private Class<L> leftClass;
        private Class<R> rightClass;
        private Integer leftMinCount;
        private Integer leftMaxCount;
        private Integer rightMinCount;
        private Integer rightMaxCount;
        private Long relationshipId;
        private Boolean allowDuplicate;

        public Builder() {

        }
        public Builder(Class<L> leftClass, Class<R> rightClass) {
            this.leftClass = leftClass;
            this.rightClass = rightClass;
        }

        public String getRelationshipName() {
            return relationshipName;
        }

        public Builder<L, R> setRelationshipName(String relationshipName) {
            this.relationshipName = relationshipName;
            return this;
        }

        public Class<L> getLeftClass() {
            return leftClass;
        }

        public Builder<L, R> setLeftClass(Class<L> leftClass) {
            this.leftClass = leftClass;
            return this;
        }

        public Class<R> getRightClass() {
            return rightClass;
        }

        public Builder<L, R> setRightClass(Class<R> rightClass) {
            this.rightClass = rightClass;
            return this;
        }

        public Integer getLeftMinCount() {
            return leftMinCount;
        }

        public Builder<L, R> setLeftMinCount(Integer leftMinCount) {
            this.leftMinCount = leftMinCount;
            return this;
        }

        public Integer getLeftMaxCount() {
            return leftMaxCount;
        }

        public Builder<L, R> setLeftMaxCount(Integer leftMaxCount) {
            this.leftMaxCount = leftMaxCount;
            return this;
        }

        public Integer getRightMinCount() {
            return rightMinCount;
        }

        public Builder<L, R> setRightMinCount(Integer rightMinCount) {
            this.rightMinCount = rightMinCount;
            return this;
        }

        public Integer getRightMaxCount() {
            return rightMaxCount;
        }

        public Builder<L, R> setRightMaxCount(Integer rightMaxCount) {
            this.rightMaxCount = rightMaxCount;
            return this;
        }

        public Long getRelationshipId() {
            return relationshipId;
        }

        public Builder<L, R> setRelationshipId(Long relationshipId) {
            this.relationshipId = relationshipId;
            return this;
        }

        public Boolean getAllowDuplicate() {
            return allowDuplicate;
        }

        public Builder<L, R> setAllowDuplicate(Boolean allowDuplicate) {
            this.allowDuplicate = allowDuplicate;
            return this;
        }

        public RelationshipBak<L, R> build() {
            return new RelationshipImpl<>(
                    relationshipId,
                    relationshipName,
                    leftClass,
                    rightClass,
                    leftMinCount,
                    leftMaxCount,
                    rightMinCount,
                    rightMaxCount,
                    allowDuplicate
            );
        }
    }


}
